import Vue from 'vue'
import Router from 'vue-router'

/**
 *
 * @method componentPath 路由模块入口
 * @param  {string} name 要引入的文件地址
 * @return {Object}
 */
// function componentPath (name = 'index/index'){
//   return {
//     //懒加载这里一直报错 import Unexpected token 目前还没解决
//       component:() => import(`../components/${name}.vue`)
//   }
// }

import Index from '../components/index/index.vue'
import Main from '../views/Main.vue'
import View1 from '../views/View1.vue' 
import View2 from '../views/View2.vue'
 
Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    // {
    //   path: '/',
    //   name: 'index',
    //   ...componentPath('index/index'),
    //   meta: {
    //     requiresAuth: false
    //   }
    // },
    { path: '/', component: Main },
    { path: '/view1', component: View1 },
    { path: '/view2', component: View2 }
  ]
})